const postModel = require('../model/adminPostModel');
module.exports = {
    getPostsByPage(req,res){
        let  {pageIndex,pageSize} = req.body;
        postModel.getPostByPage(pageIndex,pageSize,(err,result)=>{
            if(err) console.error(err);
            let resObj = {};
            if(result.length > 0){
                resObj ={
                    code : 200,
                    msg : '获取成功',
                    data : result
                }
            }else {
                resObj = {
                    code : 401,
                    msg : '获取失败'
                }
            }
            res.send(resObj);
        })
    }
}